﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminCP/admincp.Master" AutoEventWireup="true"
    CodeBehind="Config.aspx.cs" Inherits="VINETLIFE.AdminCP.Config" %>

<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function OnClientPasteHtml(sender, args) {
                var commandName = args.get_commandName();
                var value = args.get_value();
                if (commandName == "ImageManager") {
                    //See if an img has an alt tag set
                    var div = document.createElement("DIV");
                    //Do not use div.innerHTML as in IE this would cause the image's src or the link's href to be converted to absolute path.
                    //This is a severe IE quirk.
                    Telerik.Web.UI.Editor.Utils.setElementInnerHtml(div, value);
                    //Now check if there is alt attribute
                    var img = div.firstChild;
                    //alert(div.innerHTML);

                    //Set new content to be pasted into the editor

                    if (!!img.alt) {
                        var newInner = "<center>";
                        newInner = newInner + "<img src='" + img.src + "' alt='" + img.alt + "'/></center><center>";
                        newInner = newInner + img.alt + "</center>";

                        args.set_value(newInner);
                    }
                    else {
                        var newInner = "<center><img src='" + img.src + "' alt='Bao Anh jsc'/></center><br/>";

                        args.set_value(newInner);
                    }

                }
            }
        </script>
    </telerik:RadCodeBlock>
    <h2>Cập nhật Slide</h2>
    <table width="100%" border="1">
        <tr>
            <td class="style8" style="width: 150px;">Tiêu đề:
            </td>
            <td class="style9">
                <asp:TextBox ID="txtTitle" runat="server" Width="179px" ValidationGroup="submitGrp"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtTitle"
                    ErrorMessage="*** Cần nhập tiêu đề" ValidationGroup="submitGrp"></asp:RequiredFieldValidator>
                <br />

            </td>
        </tr>
        <tr id="trDes" runat="server" visible="true">
            <td class="style8">Chi tiết:
            </td>
            <td>
                <asp:TextBox ID="txtDescription" TextMode="MultiLine" runat="server" Width="90%">
                </asp:TextBox>
            </td>
        </tr>
        <tr id="trSupport" runat="server" visible="false">
            <td class="style8">Trình bày:
            </td>
            <td>
                <CKEditor:CKEditorControl ID="txtCK" runat="server" Width="90%" Visible="false">
                </CKEditor:CKEditorControl>
                <telerik:RadEditor ID="txtCKX" runat="server" OnClientPasteHtml="OnClientPasteHtml"
                    DialogHandlerUrl="~/Telerik.Web.UI.DialogHandler.axd" Width="99%" Height="700px">
                    <ImageManager MaxUploadFileSize="1024000000" ViewMode="Grid" DeletePaths="~/Media/"
                        UploadPaths="~/Media/" ViewPaths="~/Media/"></ImageManager>
                </telerik:RadEditor>
            </td>
        </tr>
        <tr runat="server" id="trPopup" visible="false">
            <td class="style8">Hình ảnh
            </td>
            <td class="style9">
                <br />
                &nbsp; &nbsp;
                <asp:FileUpload ID="fuImage" runat="server" />
                &nbsp;
                <asp:HyperLink ID="hplImage" runat="server" Target="_blank">[Xem 
            ảnh]</asp:HyperLink>
                <br />
                <br />
                &nbsp; &nbsp; Link:&nbsp;
                <asp:TextBox runat="server" ID="txtLink" Width="50%"></asp:TextBox><br />
            </td>
        </tr>
        <tr>
            <td class="style8">Active
            </td>
            <td>    
                    <asp:CheckBox ID="chkActive" runat="server" Checked="True" />
            </td>
        </tr>
        <tr>
            <td class="style8">&nbsp;
            </td>
            <td class="style4">
                <asp:Button CssClass="button-gg-green" ID="btnSave" runat="server" Text="Lưu" OnClick="btnSave_Click"
                    ValidationGroup="submitGrp" />
                <asp:Button CssClass="button-gg-green" ID="btnReset" runat="server" Text="Hủy" OnClick="btnReset_Click" />
            </td>
        </tr>
    </table>
</asp:Content>
